import java.sql.*;

public class connectortest {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.cj.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/test?useUnicode=ture&characterEncoding=utf8&UseSSL=ture";
        String username = "root";
        String password = "102123";
        Connection connection = DriverManager.getConnection(url, username, password);
        Statement statement = connection.createStatement();
        String sql="SELECT * FROM a";
        ResultSet resultSet = statement.executeQuery(sql);

        while (resultSet.next()){
            String class1 =(String) resultSet.getObject("student");
            System.out.println("名字是"+class1);

        }
    resultSet.close();
    statement.close();
    connection.close();


    }
}
